/*
	This file is part of the JKTest
    Copyright (C) 2008 Royce Y. Feng <ryfeng@gmail.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License version 3
    as published by the Free Software Foundation. You may not use, modify
    or distribute this program under any other version of the
    GNU Affero General Public License.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

package JKSysInfo;

import java.lang.Runnable;
import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * 
 * The class that gets the System information for use by a GUI
 * 
 * @author Royce Feng
 */

public class SysInfoClass implements Runnable {

    private String uName = "";
    private String cName = "";
    private String cOSArch = "";
    private String cOSName = "";
    private String cOSVersion = "";
    private String IPAddress = "";
    private String numberOfProcessors = "";
    
    /**
     * 
     * Runnable method. Gets System properties.
     * 
     */
    public void run() {
        uName = System.getProperty("user.name");
        cName = System.getenv("COMPUTERNAME");
        cOSArch = System.getProperty("os.arch");
        cOSName = System.getProperty("os.name");
        cOSVersion = System.getProperty("os.version");
        numberOfProcessors = Integer.toString(Runtime.getRuntime().availableProcessors());
        try {
            IPAddress = InetAddress.getLocalHost().getHostAddress();
        } catch ( UnknownHostException e ) {
            IPAddress = "Unknown Host";
        }
    }
    
    /**
     * 
     * Retrieves the System Property: user.name.
     * 
     * @return User Name
     */
    public String getuName() {
        return uName;
    }

    /**
     *
     * Retrieves the System Variable: COMPUTERNAME
     *
     * @return The Comptuer name
     */
    public String getcName() {
        return cName;
    }
    
    /**
     * 
     * Retrieves the System Property: os.arch
     * 
     * @return The Operating System Arch
     */
    public String getcOSArch() {
        return cOSArch;
    }
    
    /**
     * 
     * Retrieves the System Property: os.name
     * 
     * @return The Operating System Name
     */
    public String getcOSName () {
        return cOSName;
    }
    
    /**
     * 
     * Retrieves the System Property: os.version
     * 
     * @return The Operating System Version
     */
    public String getcOSVersion() {
        return cOSVersion;
    }
    
    /**
     * 
     * Retrieves the Local IP Address
     * 
     * @return Local IP Address
     */
    public String getIPAddress() {
        return IPAddress;
    }

    /**
     *
     * Retrieves the System Variable: NUMBER_OF_PROCESSORS
     *
     * @return The number of processors
     */
    public String getnumberOfProcessors() {
        return numberOfProcessors;
    }
    
}